1. Field of the Invention
The present invention relates to an information processing apparatus, an information processing method, and a program therefor. More specifically, the present invention relates to an information processing apparatus, an information processing method, and a program whereby processing is executed to read data recorded in a storage device, for example.
2. Description of the Related Art
Recently, storage devices are being used as the data storage apparatus for equipment such as personal computers (PCs), cameras, and PDAs. A storage device is connected to a PC, camera, PDA, or similar host via an interface (I/F) such as USB (Universal Serial Bus) or SATA (Serial ATA), and data is transferred with the host.
When, for example, the host reads data from the storage device, a Read command is used as stipulated by a standard between the host and the storage device, such as ATAPI (ATA Attachment Packet Interface) or SCSI (Small Computer System Interface).
Hereinafter, an exemplary case of using the READ(10) command of the SCSI standard will be described as one example of a typical data transfer process between a host and a storage device in the related art. FIG. 1 illustrates the format of the READ(10) command in the SBC-2 (SCSI Block Commands-2) of the SCSI standard. The READ(10) command has a 10-byte structure made up of bytes 0 to 9, as shown in FIG. 1.
The 0th byte is the operation code field, the 2nd through 5th bytes are the logical block address field (hereinafter also referred to as the LBA field), and the 7th through 8th bytes are the transfer length field. Fields unrelated to the present invention are herein omitted from description.
The operation code field expresses an identifier for the command. In the present example, the operation code is 28h, which indicates that the present command is READ(10). The LBA field stores the logical block address (LBA) of the beginning of the data requested by the host. The storage device reads the data at the logical block address (LBA) specified by the command and sequential addresses thereafter, and successively transfers the data to the host. The transfer length field stores the total transfer length of the data requested by the host. The units of transfer length in READ(10) are logical blocks. For example, if one block is 512 bytes, then a single unit becomes 512 bytes, and the transfer length multiplied by 512 bytes yields the data transfer length in units of bytes.
When the host requests the storage device to read data using the READ(10) command, the host first stores respective parameters for the operation code, the logical block address (LBA), and the transfer length within the READ(10) command, and then transfers the command to the storage device. Upon receiving the command sent from the host, the storage device determines that the present command is the READ(10) command by referencing the operation code field of the command. Next, the storage device sequentially reads data in address order starting from the logical block address indicated by the LBA field, and sends the data to the host. The storage device sends data having the length indicated by the transfer length field, and then terminates data transfer. The above thus summarizes the data transfer method for the READ(10) command.
Meanwhile, the data requested by the host might be scattered among the logical block addresses (LBAs) of the storage device. A data storage example in the case of a representative file system, FAT (File Allocation Table), will now be described by way of example with reference to FIG. 2. FIG. 2 illustrates the relationship between stored data and the logical block addresses that have been set in accordance with the memory managed by the storage device.
As shown in FIG. 2, in the FAT file system, a single file might be scattered among a plurality of logical block addresses, and the data might not be arranged in sequential logical block addresses. In the example shown in FIG. 2, the actual data constituting a file A is scattered among regions 1, 2, and 3. This state called file fragmentation. The actual data for a file B is stored in a region 4.
In addition, when the host requests the storage device to read multiple files, the requested data might be scattered among different logical block addresses, and the data might not be arranged in sequential logical block addresses. In such cases, the host acquires the desired data by sending individual read commands to the storage device for each logical block address corresponding to the scattered data.
Storing data in a scattered manner on a storage device leads to a decrease in the speed of data transfer between the host and the storage device. The cause of the above will now be described with reference to FIG. 3. FIG. 3 illustrates a sequence in the case of the host reading data from the storage device.
The sequence diagram shown in FIG. 3 illustrates a processing sequence for the case of reading a file A, which was divided and recorded to the regions 1 to 3 shown in FIG. 2. First, in step S11, the host sends a read command to the storage device, requesting to read the region 1 shown in FIG. 2. Upon receiving the command, in step S12 the storage device acquires the logical block address requested by the host from the LBA (logical block address) field, and initiates reading of the data specified by the logical block address, or in other words, the data in the region 1. Subsequently, in step S13, the storage device successively transfers the data read from the region 1 to the host.
After completely receiving the requested data in the region 1, in step S14 the host sends a read command to the storage device requesting to read the next region 2. Upon receiving the command, in step S15 the storage device initiates reading of the data in the region 2, and in step S16, successively transfers the data read from the region 2 to the host.
Furthermore, after completely receiving the requested data in the region 2, in step S17 the host sends a read command to the storage device requesting to read the next region 3. Upon receiving the command, in step S18 the storage device initiates reading of the data in the region 3, and in step S19, successively transfers the data read from the region 3 to the host.
In this way, individual read commands set with the logical block addresses corresponding to respective memory regions are generated and sent by the host for each of the plurality of scattered regions constituting part of the entire memory region storing the file to be read. The storage device likewise reads data from the respective regions for each of the plurality of commands from the host, and successively replies to the host with the read data. In this case, the storage device does not execute any processing during the time between the end of the last data transmission for a given read command and the arrival of the next read command. In other words, wasted time is produced. The periods A and B shown in FIG. 3 correspond to such wasted time.
Also, the storage device first learns the logical block address requested by the host upon receiving the next read command from the host, and only then begins to actually read the media. For this reason, data is not returned to the host immediately after receiving a command. This becomes an additional cause of the decrease in the speed of data transfer.
Furthermore, the fact that individual read commands are sent for each of the scattered logical block addresses means that the processing to receive a command and analyze its contents is repeated in the storage device for each sent command. Such processing takes time. In addition, data transfer for announcing the state of the storage device is also conducted in the network transport layer, which governs the exchange of typical commands, such as for USB bulk-only transport, for example. Such processing becomes an additional cause of the decrease in the speed of data transfer.
Technology of the related art that discloses countermeasures for the decreases in data transfer rate given above will now be described. First, Japanese Unexamined Patent Application Publication No. 2006-277737 discloses a configuration that utilizes file management information in a FAT (File Allocation Table) file system. Stated in the file management information is cluster chain information for the logical block addresses (LBAs) where the data constituting a single file is recorded. The disclosed configuration utilizes this information.
In other words, by referencing the LBA cluster chain information in the file management information, the controller of the storage device acquires in advance the logical block addresses corresponding to the plurality of individual scatter locations of a file that has been recorded in a scattered manner. Applying this acquired information, the controller predicts the logical block address of the data to be requested by the host after the logical block address in the read command last received from the host. By means of this process, efficient read operations are conducted.
However, the problem with this method is that there is nothing to guarantee that the address predicted in the storage device is the correct address. In other words, the host might suddenly initiate the reading of a separate file, and in this case, the address predicted in the storage device is not used. When the prediction misses in this way, reading of the media by the storage device is aborted, and media reading is restarted at the correct logical block address. There is thus a problem in that when the above situation occurs, the time until data acquisition by the host is significantly delayed rather than improved.
Additionally, since the method for predicting a logical block address given in Japanese Unexamined Patent Application Publication No. 2006-277737 involves predicting from convergence information regarding scattered logical addresses in the file system management information, there is a flaw in that the method is not effective with respect to read commands for multiple files.
Meanwhile, Japanese Unexamined Patent Application Publication No. 2008-210226 discloses a method utilizing an expanded Read command, wherein a plurality of logical block addresses and transfer lengths are specified within the CDB (Command Descriptor Block) of a single command. In so doing, a pseudo-plurality of Read commands are sent with just one command.
With this method, the storage device is able to batch learn a plurality of logical block addresses corresponding to data requested by the host in advance. However, when the implementation follows representative command standards such as the ATAPI and SCSI given earlier, or any of various transport layer protocols, the number of logical block addresses and transfer lengths specifiable at once is limited. For example, in USB bulk-only transport, the maximum command length is 16 bytes. If such standards are not followed, the implementation becomes an independent standard. Since the device driver layer of the host is independently implemented, the above method is flawed in that versatility is compromised in host application development.
Furthermore, the configuration in Japanese Unexamined Patent Application Publication No. 2008-210226 is also flawed in that the method involves securing a large amount of memory for saving the command data in the storage device when there are large numbers of logical block addresses (LBAs) and data transfer lengths sent with one command. For example, an architecture wherein 10000 logical block addresses and data transfer lengths are sent and a single LBA is 8 bytes involves securing a memory region for receiving and storing 80000 bytes in the storage device. This is not realistic for typical embedded devices. As a result, the expanded Read command described above is split several times before being sent. There is thus a flaw in above method in that the advantage of decreasing the number of issued commands is only weakly effective.